<?php
include "connect.php";
include "functions.php";

$tablename = "badge_id";
 
//  $query="SELECT * FROM $tablename ORDER BY `id` DESC LIMIT 0, 100 ";
  $query="SELECT * FROM badge_id ORDER BY `id`";
      $result = mysqli_query($con, $query) or die("query:" . mysql_error($con));
	  $num = mysqli_num_rows($result);
	  					   
	  $i=0;
//while ($i < $num) {

	$id = mysqli_result($result,$i,"id");
	$name= mysqli_result($result,$i,"name");
	$driver_id = mysqli_result($result,$i,"driver_id");
	$sta = mysqli_result($result,$i,"sta");
	$photo = mysqli_result($result,$i,"photo");
	$indie_con = mysqli_result($result,$i,"indie_con");
	$status = mysqli_result($result,$i,"status");
	$flag = mysqli_result($result,$i,"flag");
	$exp_date = mysqli_result($result,$i,"exp_date");
	
	
	
//echo date_timestamp_get($date);
 //}
   
   			
   	  $sql="INSERT INTO saved_badge_id (id, name, driver_id, sta, photo,indie_con,status,flag,exp_date,creation_date) 
	  VALUES ('', '$name', '$driver_id', '$sta', '$photo', '$indie_con', '$status', '$flag', '$exp_date', NOW())";
	  
	  if (!mysqli_query($con, $sql))
  {
     die('Error: ' . mysqli_error($con));
  }
   
   
   
   mysqli_close($con);

echo "<span style='color: black; font-size: 9px;'>badge saved  :".$name;
?>